feat(memory): add metadata support to MemoryClient events#236
Merged
Conversation
Add metadata parameter to create_event, create_blob_event, fork_conversation, and event_metadata filter to list_events in MemoryClient. - create_event: Added optional metadata parameter for attaching key-value metadata - create_blob_event: Added optional metadata parameter - list_events: Added event_metadata filter for querying events by metadata - fork_conversation: Added optional metadata parameter (passes through to create_event) Metadata supports up to 15 key-value pairs with keys 1-128 characters. Filtering supports EQUALS_TO, EXISTS, and NOT_EXISTS operators.
3e281fd to
368dec3
Compare
aidandaly24
reviewed
Jan 30, 2026
| session_id: str, | ||
| branch_name: Optional[str] = None, | ||
| include_parent_branches: bool = False, | ||
| event_metadata: Optional[List[EventMetadataFilter]] = None, |
Contributor
There was a problem hiding this comment.
nit: The EventMetadataFilter TypedDict in filters.py defines operator: OperatorType (enum), but the docstring examples correctly show passing the string "EQUALS_TO" directly, which is what boto3 actually needs.
This works fine at runtime since Python doesn't enforce TypedDict, and the examples are correct. The root issue is in filters.py where operator should probably be typed as str rather than OperatorType. Worth a follow-up cleanup but def not a blocker for this PR. Should I create an issue for this? Or can we have strands do it?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
metadataparameter tocreate_event,create_blob_event, andfork_conversationmethodsevent_metadatafilter parameter tolist_eventsmethod for querying events by metadataEQUALS_TO,EXISTS, andNOT_EXISTSoperatorsTest plan
create_eventwith metadatacreate_blob_eventwith metadatalist_eventswith event_metadata filterlist_eventswith combined branch and metadata filtersfork_conversationwith metadata